package com.augurit.gzcgwsp.rqqyjyxk.service.impl;

import java.util.List;

import org.hibernate.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.augurit.gzcgwsp.rqqyjyxk.dao.YwRqQyjyxkFinalRqqxssdjbDao;
import com.augurit.gzcgwsp.rqqyjyxk.entity.YwRqQyjyxkFinalRqqxssdjb;
import com.augurit.gzcgwsp.rqqyjyxk.service.IYwRqQyjyxkFinalRqqxssdjbService;
/**
 * 
 * <P>title:最终数据燃气抢险设施service实现类</p>																								
 * <P>Description：</p>
 * <p>Copyright: Copyright (c) 2011 augurit</p>
 * <p>Company: 广州奥格智能科技</p>
 * History：
 * @author:zhangjun
 * @date Oct 15, 2011
 * @version 1.0
 */
@Service("rqqxssService")
@Transactional
public class YwRqQyjyxkFinalRqqxssdjbServiceImpl   implements IYwRqQyjyxkFinalRqqxssdjbService{
	@Autowired
	private YwRqQyjyxkFinalRqqxssdjbDao rqqxssDao;

    public List<YwRqQyjyxkFinalRqqxssdjb> getInfosByQyid(Long qyid) {
       String  sql=" from "+ YwRqQyjyxkFinalRqqxssdjb.class.getName()+" where qyid='"+qyid+"'";
        return rqqxssDao.find(sql);
    }

    public void save(YwRqQyjyxkFinalRqqxssdjb finalentity) {
        if(finalentity!=null &&finalentity.getId()!=null){
            //转换类的时候id不同了所以用这种方式更新
            Session session=rqqxssDao.getSession();
            session.flush();
            session.clear();
            session.saveOrUpdate(finalentity);
        }else{
            rqqxssDao.save(finalentity);
        }
    }



    

}
